package net.labdemo.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import net.labdemo.common.dao.BaseEntityDao;
import net.labdemo.common.entity.BaseEntity;
import net.labdemo.common.service.BaseEntityService;
import net.labdemo.common.util.Page;
/**
 * 服务基础接口的实现
 * @author xiaofanku
 * 20160614
 * @param <T>
 */
@Transactional(readOnly = true)
public abstract class BaseEntityServiceSupport<T extends BaseEntity<T>,D extends BaseEntityDao<T>> implements BaseEntityService<T> {
	/**
	 * 持久层对象
	 */
	@Autowired
	protected D dao;
	
	@Override
	public Page<T> selectPage(T condition, Page<T> page) {
		// TODO Auto-generated method stub
		//向着[数据库],主要附加cursor属性
		condition.setPage(page);
		System.out.println(condition.getPage());
		//向着[mvc],主要携带结果集和页码结构
		page.setResult(dao.findPage(condition));
		return page;
	}

}
